Constants with Equal Value (CEV)

Description:

CEV detects constants with equal values declared in the same class or interface. The presence of different constants with equal values may indicate a problem if these constants belong to the same group.

Incorrect:

public Const
  Sunday : Integer    = 0;
  Monday : Integer    = 1;
  Tuesday : Integer   = 2;
  Wednesday : Integer = 3;
  Thursday : Integer  = 4;
  Friday : Integer    = 5;
  Saturday : Integer  = 0;

// This method would never return "Saturday"  
function GetDayName(day : integer) : string;
  begin
    if day = Sunday then result := 'Sunday'
    ...
    else if day = Saturday then result := 'Saturday';
  end;

Correct:

public Const
  Sunday : Integer    = 0;
  Monday : Integer    = 1;
  Tuesday : Integer   = 2;
  Wednesday : Integer = 3;
  Thursday : Integer  = 4;
  Friday : Integer    = 5;
  Saturday : Integer  = 6;